﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8" />
  	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Dreamer CMS - 后台管理系统</title> 
    <link href="/resource/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/resource/css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="row">
    <div class="col-md-12">
    	<h1 class="panel-heading">编辑变量</h1>
        <!--breadcrumbs start -->
        <ul class="breadcrumb">
			<li><a href="/admin/dashboard/toIndex"><i class="fa fa-home"></i> 首页</a></li>
			<li class="active">编辑变量</li>
		</ul>
        <!--breadcrumbs end -->
    </div>
</div>
<section class="panel">
	<div class="panel-body">
		<form class="col s12" id="form1" enctype="multipart/form-data" th:action="@{/admin/variable/update}" onsubmit="return validateForm();" method="post">
			<input type="hidden" th:value="${variable.id}" id="id" name="id"/>
			<div class="form-group form-control-medium">
				<label for="itemName">变量名：</label>
				<input id="itemName" name="itemName" type="text" th:value="${variable.itemName}" class="form-control" placeholder="变量名" />
			</div>
			<div class="form-group form-control-medium">
				<label for="info">描述：</label>
				<input id="info" name="info" type="text" th:value="${variable.info}" class="form-control" placeholder="描述" />
			</div>
			<div class="form-group form-control-medium">
				<label for="value">变量值：</label>
				<input id="value" name="value" type="text" th:value="${variable.value}" class="form-control" placeholder="变量值" />
			</div>
			<div class="form-btn-group-left" shiro:hasAnyPermissions="system:variable:toedit,system:variable:update">
            	<button type="submit" class="btn btn-info">保存</button>
            </div>
		</form>
	</div>
</section>
<script src="/resource/js/jquery.min.js"></script>
<script src="/resource/js/coco-message/coco-message.js"></script>
<script th:inline="javascript">
   	/* 保存方法 */
    function validateForm(){
    	var itemName = $("#itemName").val();
    	if(itemName == null || itemName==''){
    		cocoMessage.error("变量名不能为空");
    		return false;
    	}
    	return true;
    }
</script>
</body>
</html>
